<% layout('/layouts/default.html', {title: '问题管理', libs: ['dataGrid']}){ %>
<div class="main-content">
	<div class="box box-main">
		<div class="box-header">
			<div class="box-title">
				<i class="fa icon-trophy"></i> ${text('问题管理')}
			</div>
			<div class="box-tools pull-right">
				<a href="#" class="btn btn-default" id="btnSearch" title="${text('查询')}"><i class="fa fa-filter"></i> ${text('查询')}</a>
				<a href="${ctx}/suggestion/question/form" class="btn btn-default btnTool" title="${text('新增问题')}"><i class="fa fa-plus"></i> ${text('新增')}</a>
			</div>
		</div>
		<div class="box-body">
			<#form:form id="searchForm" model="${question}" action="${ctx}/suggestion/question/listData" method="post" class="form-inline hide"
					data-page-no="${parameter.pageNo}" data-page-size="${parameter.pageSize}" data-order-by="${parameter.orderBy}">
				<div class="form-group">
					<label class="control-label">${text('问题标题')}：</label>
					<div class="control-inline width-120">
						<#form:input path="questionTitle" maxlength="64" class="form-control width-120"/>
					</div>
				</div>
				<div class="form-group">
					<label class="control-label">${text('问题分类')}：</label>
					<div class="control-inline width-90">
						<#form:select path="questionType" dictType="sg_question_type" blankOption="true" class="form-control"/>
					</div>
				</div>
				<div class="form-group">
					<label class="control-label">${text('状态')}：</label>
					<div class="control-inline width-120">
						<#form:select path="stage" dictType="question_stage" blankOption="true" class="form-control"/>
					</div>
				</div>
				<div class="form-group">
					<button type="submit" class="btn btn-primary btn-sm">${text('查询')}</button>
					<button type="reset" class="btn btn-default btn-sm">${text('重置')}</button>
				</div>
			</#form:form>			
			<table id="dataGrid"></table>
			<div id="dataGridPage"></div>
		</div>
	</div>
</div>
<% } %>
<script>
// 初始化DataGrid对象
$('#dataGrid').dataGrid({
	searchForm: $("#searchForm"),
	columnModel: [
		{header:'${text('状态')}', name:'stage', index:'a.stage', width:80, align:"center", formatter: function(val, obj, row, act){
			return  js.getDictLabel(${@DictUtils.getDictListJson('question_stage')}, val, '未知', true);
		}},
		{header:'${text('问题标题')}', name:'questionTitle', index:'a.question_title', width:100, align:"left"},
		{header:'${text('问题分类')}', name:'questionType', index:'a.question_type', width:100, align:"center", formatter: function(val, obj, row, act){
			return js.getDictLabel(${@DictUtils.getDictListJson('sg_question_type')}, val, '未知', true);
		}},
		{header:'${text('建议人')}', name:'user.userName', index:'a.question_dept_code', width:100, align:"left"},
		{header:'${text('问题部门')}', name:'office.officeName', index:'a.question_dept_code', width:100, align:"left"},
		{header:'${text('问题描述')}', name:'remarks', index:'a.remarks', width:200, align:"left"},
		{header:'${text('问题负责人')}', name:'questUser.userName', index:'a.quest_user', width:100, align:"left"},
		{header:'${text('更新时间')}', name:'updateDate', index:'a.update_date', width:150, align:"center"},
		{header:'${text('操作')}', name:'actions', width:80, sortable:false, title:false, formatter: function(val, obj, row, act){
			var actions = [];
			if(row.bzStatus==1)
				actions.push('<a href="${ctx}/suggestion/question/form?questionCode='+row.questionCode+'" class="btnList" title="${text('编辑或提交')}"><i class="fa fa-pencil"></i></a>&nbsp;');
			actions.push('<a href="${ctx}/suggestion/question/show?questionCode='+row.questionCode+'" class="btnList" title="${text('查看建议')}"><i class="fa fa-eye"></i></a>&nbsp;');
			if(row.stage==1 && row.bzStatus==1)
				actions.push('<a href="${ctx}/suggestion/question/delete?questionCode='+row.questionCode+'" class="btnList" title="${text('删除建议')}" data-confirm="${text('确认要删除吗？')}"><i class="fa fa-trash-o"></i></a>&nbsp;');
			return actions.join('');
		}}
	],
	// 加载成功后执行事件
	ajaxSuccess: function(data){
		
	}
});
</script>